import requests

# 你获得的 TikTok Shop API 访问令牌 (Access Token)
access_token = "YOUR_ACCESS_TOKEN"

# TikTok Shop API 基础 URL
# api_url = "https://partner.tiktokshop.com/api/v1/products/"
api_url = "https://partner.tiktokshop.com/api/products/details"

# 构建请求头，加入认证信息
headers = {
    "Authorization": f"Bearer {access_token}",
    "Content-Type": "application/json"
}

# 发送 GET 请求（举例）
response = requests.get(api_url, headers=headers)

# 检查响应状态
if response.status_code == 200:
    # 打印 API 返回的结果
    print(response.json())
else:
    print(f"请求失败，状态码：{response.status_code}")


#  'https://open-api.tiktokglobalshop.com/api/products/details?product_id=1729592969712207008&need_audit_version=false&sign=5361235029d141222525e303d742f9e38aea052d10896d3197ab9d6233730b8c&shop_cipher=GCP_XF90igAAAABh00qsWgtvOiGFNqyubMt3&shop_id=36123502970007&version=202212&app_key=38abcd&timestamp=1623812664&access_token=ROW_lueRwg4DEVhW7y9az74MgYA8y24seCBcjItc6CY8PGpsdgKZ4aOMGHKejG566H2mPj-jemiTXWkkZdnM5eTo11xqCRIZFihUe6VhBKKYzYsdjZDxg46ER8EffWnbeLBEjUUatmM4zpBIzyy_MPmJOdQh-Z54DX-A' \
# -H 'content-type: application/json'

# Request
#  Quer
#   app_key                 string      Every single app will have a unique key. Please use the specific key assigned to your app.
#   timestamp               timestamp   Unix timestamp GMT (UTC+00:00). This timestamp is used across all API requests. Developers can use this convert to local time.
#   sign                    string      Signature generated by gen algorithm. When you send API requests to TTS, you must sign them so that TTS can identify the senders.
#   access_token            string      Authorization Token, provided for all eligible TikTok Shop Partner Developers.
#   version                 int32       The interface version you want to access
#   shop_cipher             string
#   shop_id                 int         The id of your shop
#   product_id              string      product id
#   need_audit_version      bool        se this parameter to retrieve the version of product information that is under auditing. Without this parameter passed as "true", the API response will only contain the live version of product information.